<template>
  <div>
    <h1>加加减减</h1>
    <ul>
      <li v-for="(item, index) in arr" :key="index">{{ item }}<button @click="arr.splice(index, 1)">删除</button></li>
    </ul>
    <button @click="add">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: []
    }
  },
  methods: {
    add() {
      this.arr.push(Math.random())
    }
  }
}
</script>

<style></style>
